home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 September / CHIP Eylül 1998.iso / Slackwar / docs / Java-HOWTO < prev    next >
Text File  |  1996-06-02  |  31KB  |  760 lines

  1.   Linux Java HOWTO
  2.   maintained by Eric S. Raymond, esr@snark.thyrsus.com
  3.   v2.3, 29 May 1996
  4.  
  5.   This document describes how to get started with Java and HotJava under
  6.   Linux, as either a user or a programmer.
  7.  
  8.   1.  Introduction
  9.  
  10.   This document is a Linux-centric introduction to the world of Java and
  11.   HotJava.  These technologies are rapidly evolving, and we welcome
  12.   contributions from anywhere.
  13.  
  14.   Places in this document that are in serious need of checking or
  15.   filling out are bracketed with *** ***.  Also see the ``To Be
  16.   Added...'' section below.  Please help us improve this HOWTO.  Send
  17.   updates and change requests to <esr@snark.thyrsus.com>.
  18.  
  19.   2.  General Questions About Java and HotJava
  20.  
  21.   This section is a general (non-Linux-specific) introduction to Java
  22.   and HotJava.
  23.  
  24.   2.1.  What are are Java and HotJava and why are they interesting?
  25.  
  26.   Java is a network-aware language superficially resembling C++, but
  27.   much smaller and more compact and cleanly designed.  It's an
  28.   unlimited-extent language with garbage collection like Lisp, but with
  29.   static type checking (it's been aptly described as "Smalltalk with
  30.   sane syntax").  It includes lightweight processes (threads) as a
  31.   native facility and has powerful network-security features.  So far,
  32.   its major application is the HotJava browser, but it holds
  33.   considerable promise as a general-purpose application language.
  34.  
  35.   HotJava is a WWW browser written in Java.  Its major advance over most
  36.   other browsers is that it knows about a new HTML construct called an
  37.   APPLET, which is some Java class that executes on the client machine.
  38.   Thus, WWW documents written with Java in mind can have "live" code
  39.   objects embedded in them, as opposed to just data.
  40.  
  41.   The ability to safely pass around code objects probably represents the
  42.   most significant advance in WWW technology since the first release of
  43.   Mosaic.  At minimum, it delivers an extensible Web browser that won't
  44.   need perpetual upgrading to handle new image formats and tag types.
  45.  
  46.   Java is compiled into a pseudo-code called `J-code'; Java interpeters
  47.   execute J-code.  J-code may be on its way to becoming a universal
  48.   architecture-independent virtual machine-code or compiler intermediate
  49.   language.  We hear rumors that an ADA-95 compiler that generates J-
  50.   code has already been built and that a C compiler is in progress;
  51.   eventually, it's likely that multiple front-end languages will be
  52.   available for writing either applets or standalone programs on any
  53.   machine hosting a Java interpreter.
  54.  
  55.   2.2.  Where do Java and HotJava come from?  Who can use them?
  56.  
  57.   Java and HotJava were developed at Sun Microsystems by a team headed
  58.   by James Gosling (well known as the designer of Gosling Emacs and
  59.   NeWS).
  60.  
  61.   The last time Sun tried to set a major technical standard was NeWS,
  62.   its Network Window System.  Though NeWS was pretty universally
  63.   conceded to be technically superior to X, X won because its sources
  64.   were freely redistributable.  Sun learned from this mistake, and has
  65.   made Java/HotJava much more generally available; the sources can be
  66.   downloaded under a fairly relaxed license (see ``Java as Freely
  67.   Redistributable Software'').  Sun is encouraging ports to non-Sun
  68.   environments.
  69.  
  70.   Netscape now interprets Java.  Microsoft licensed the technology in
  71.   early December 1995.  So it appears that Java support will probably
  72.   become universal in 1996.
  73.  
  74.   Java used to be called Oak.  HotJava was once known as WebRunner.
  75.  
  76.   2.3.  How mature is Java?
  77.  
  78.   On December 12 1995 Sun released the `Beta 2' version of Java.  A
  79.   month later it released 1.0, the first `production' version.  The Java
  80.   environment API defining its access to the host OS and windowing
  81.   system has allegedly been semi-frozen -- it may be extended, but won't
  82.   be incompatibly changed.
  83.  
  84.   The 1.0 version of this FAQ was issued along with the beta 1.0 Java
  85.   Developer's Kit (JDK) for Linux, ported by Randy Chapman.
  86.  
  87.   Significant holes are known to exist in the Java security
  88.   implementation.  It is not yet a good idea to use Java for sensitive
  89.   applications.  These problems are expected to be fixed in the
  90.   production (post-beta) releases.
  91.  
  92.   2.4.  Where can I find documentation on Java and HotJava?
  93.  
  94.   Sun maintains an extensive HTML web of Java and HotJava-related
  95.   documents at  <http://java.sun.com>.  These documents are mirrored at
  96.   <http://java.blackdown.org> and elsewhere; see Sun's list of mirror
  97.   sites.
  98.  
  99.   2.5.  Yes, but where can I find paper documentation?
  100.  
  101.   SunSoft Press's official series of Java books is in the production
  102.   pipeline at Addison-Wesley.  Some details about these can be found in
  103.   the comp.lang.java FAQ <http://www.city-net.com/~krom/java-faq.html>.
  104.  
  105.   Several Java early-adopters have recommended "Hooked on Java" by the
  106.   members of the Java team.  "Well written, though I'd appreciate
  107.   something less basic" was one comment.
  108.  
  109.   O'Reilly Associates is working on its own series of Java books in
  110.   cooperation with Sun.  Your humble editor is the primary technical
  111.   reviewer for this series.  So far (as of May 1996), only the "Java In
  112.   a Nutshell" guide has come out; it's pretty good. The series will
  113.   include (at least) a language reference, a class library reference,
  114.   and a book on the underlying byte-code virtual machine.
  115.  
  116.   SAMS has a book called "Learning Java in 21 Days".  No review yet.
  117.  
  118.   One of our contributors, browsing his local Bookstop/Barnes &
  119.   Noble/Borders, came up with 3 books already out:
  120.  
  121.   ╖  One called 'Java in 60 minutes' that looked like a pretty strict
  122.      syntactic description (about $20).
  123.  
  124.   ╖  One from SamsNet called just `Java' (about $20).
  125.  
  126.   ╖  One by Tim Ritchey called `Java!' that includes a CD-ROM (about
  127.      $35).
  128.  
  129.      Our informant continues: "I bought the 3rd one (by Tim Ritchey).
  130.      Paper leadtimes being what they are, the CD-ROM only has alpha
  131.      stuff, though it mentions that the beta version might be out by the
  132.      time you read it and suggests java.sun.com as a place to get more
  133.      recent information.  Other than that, it's pretty good, even to
  134.      pointing out that `well, it's pointless for me to spam you with
  135.      pages and pages of API descriptions because 1) it would quadruple
  136.      the size of the book and 20 they're still ch anging and 2) you can
  137.      get that info online at ...etc'"
  138.  
  139.   Dave Dittrich writes: I'd say that "Java in 60 minutes" may take you
  140.   60 minutes to read, but won't teach you how to program in Java in 60
  141.   minutes (surprise, surprise!)  It looks to me like "Java in 60
  142.   minutes" is one of the many attempts be first to market with a book on
  143.   a hot topic.  It didn't seem to include much more than you can find
  144.   right now on the Web, including lots of text that looks like it was
  145.   lifted straight out of the Java Language Specification
  146.   (http://java.sun.com/JDK-beta2/psfiles/javaspec.ps).
  147.  
  148.   Dave continues: Same thing with "Java!", only the latter goes into
  149.   much more detail on object oriented programming concepts, etc.
  150.   Someone pointed me to another text book that is equally as good at
  151.   covering data/method abstraction and other object oriented programming
  152.   concepts, which is "Structure and Interpretation of Computer Programs"
  153.   by Abelson, Sussman and Sussman (MIT Press).
  154.  
  155.   Final caveat: at this point (January 1996), it is probly a good idea
  156.   to stay away from the Ritchey book or anything else based on the alpha
  157.   API.  The beta API is substantially different, and the soon-to-be-
  158.   released Java 1.0 will have its own differences.
  159.  
  160.   2.6.  Where can I find on-line collections of Java code?
  161.  
  162.   WWW archives of applets are available at the following locations:
  163.  
  164.   ╖  <http://java.sun.com/>
  165.  
  166.   ╖  <http://www.applets.com/>
  167.  
  168.   ╖  <http://www.gamelan.com/>
  169.  
  170.   ╖  <http://www.javasoft.com/applets/applets.html>
  171.  
  172.      Most of the applets on these pages come with source code, and
  173.      programmers are invited to use them.
  174.  
  175.   Pointers to others may be available in the comp.lang.java FAQ
  176.   <http://www.city-net.com/~krom/java-faq.html>.
  177.  
  178.   3.  Java as Freely Redistributable Software
  179.  
  180.   Many Linux programmers are attached to producing freely
  181.   redistributable software (FRS), and try to avoid committing a lot of
  182.   time to tools for which sources are not generally available.  In this
  183.   section, we discuss Sun's and Java's relationship with the FRS world.
  184.  
  185.   (Warning: I am not a lawyer.  I am neither employed by, nor an agent
  186.   of, nor a stockholder in, Sun Microsystems.  This section is based on
  187.   my interpretation of the current copyright law and the Sun licensing
  188.   language.  Treat this as an introduction; the Sun licensing page,
  189.   <http://www.blackdown.org/Java/licensing.html> is definitive. If you
  190.   are in serious doubt about what it means, consult an attorney.)
  191.  
  192.   3.1.  Are Java programs and applets freely redistributable?
  193.  
  194.   They are if you write them and choose to make them FRS through some
  195.   mechanism (such as the GPL, or a BSD-style license, or declaring them
  196.   public domain).
  197.   3.2.  What can I do with Java implementation binaries?
  198.  
  199.   The Sun licensing page has this to say:
  200.  
  201.        The unmodified Java and HotJava binary releases may be
  202.        redistributed free of charge in both commercial and non-
  203.        commercial applications.
  204.  
  205.   Also:
  206.  
  207.        Companies or individuals who wish to create a new port of
  208.        the Java language have the right under this agreement to
  209.        post the binaries of that port to the Internet for use by
  210.        others, as long as the port is free of charge and passes the
  211.        publicly available test suites. (Test suites will be avail¡
  212.        able sometime in the first half of 1996.) The "diffs" may
  213.        also be posted on the web as long as the underlying source
  214.        code is not posted. The Java source code is
  215.  
  216.   So if you've got a working Java or HotJava binary, you can give it to
  217.   your buddies.  Or put it on a CD-ROM.  Or do anything except patch it
  218.   and represent the patched version as Java.  (This is reasonable.  Sun
  219.   obviously can't leave itself without recourse against Trojan horses
  220.   sailing under the Java banner.)  Binaries are FRS.
  221.  
  222.   3.3.  Which parts of the Java sources are freely redistributable?
  223.  
  224.   According to Sun's licensing page, none of it is.  But that sounds
  225.   harsher than it is.  In practice, anyone can get the Java and HotJava
  226.   sources for educational, porting, and non-commercial purposes by
  227.   filling out a Web form which obligates them not to redistribute the
  228.   sources.  And the agreement does permit redistribution of diffs
  229.   against the sources.
  230.  
  231.   The only circumstance that requires you to sign a commercial license
  232.   with Sun and pay them money is if you want to use the sources in a
  233.   commercial product.  In particular, the way the language is written,
  234.   it's within the letter and spirit of the agreement for you to sign
  235.   Sun's noncommercial source license, snarf the source, port it, and
  236.   give away the resulting binaries as completely unencumbered freeware!
  237.  
  238.   Sun says that its primary purpose in keeping as much control as it has
  239.   is to keep the language from mutating into incompatible dialects.  The
  240.   license language supports this; it seems to have been designed to
  241.   allow hackers to play for free.
  242.  
  243.   3.4.  What is Sun's attitude towards FRS Java implementations and
  244.   tools?
  245.  
  246.   The Sun licensing page says:
  247.  
  248.        The specifications for the Java Language and the Java Vir¡
  249.        tual Machine are OPEN and are copyrighted by Sun Microsys¡
  250.        tems, Inc.
  251.  
  252.        Reimplementations of the Java Compiler or the Java Runtime
  253.        Interpreter are permitted without requiring a license from
  254.        Sun provided such implementations are created directly from
  255.        the published specifications and without the direct or indi¡
  256.        rect use of Sun's own implementations or other intellectual
  257.        property rights, including trademarks.
  258.  
  259.   So if you want to go to the effort of creating a Java clone from the
  260.   published specifications that is FRS, Sun won't stop you.
  261.  
  262.   Sun people use the term "rogue port" for Java implementations that
  263.   either (a) are performed outside Sun, or (b) don't rely on Sun-
  264.   licensed code (sometimes the term seems to mean one thing, sometimes
  265.   the other).  They seem to think some of these already exist, but we
  266.   don't know where they are, nor if they are FRS.  They're pretty
  267.   relaxed about the situation.
  268.  
  269.   Sun has a Java validation suite.  They have said they'll certify any
  270.   Java port that passes it.  (Whether this validation will cost money is
  271.   unknown, but Sun says in writing that the suite wil be "publicly
  272.   available" in 1996, which at least hints that it will not.) They're
  273.   prepared to certify rogue ports, though this apparently hasn't
  274.   happened yet.
  275.  
  276.   3.5.  Is anyone cloning Java in freely redistributable source?
  277.  
  278.   There is a clone of the Java compiler in early development.  It's
  279.   called guavac.  You can find more information at
  280.   <http://http.cs.berkeley.edu/~engberg/guavac>
  281.  
  282.   There is a free runtime Java system called Kaffe. You can find more
  283.   information at <http://web.soi.city.ac.uk/homes/tim/kaffe/kaffe.html>.
  284.   There's a FAQ at
  285.   <http://web.soi.city.ac.uk/homes/tim/kaffe/faq.html>.
  286.  
  287.   There was a rumor afloat that Cygnus Software's GROW project has plans
  288.   for a Java byte code interpreter to be issued under GPL.  This is
  289.   false; what they are working on is a Java-to-native-code compiler that
  290.   doesn't go through J-code.  You can get more information on related
  291.   efforts at
  292.   <http://webhackers.cygnus.com/webhackers/projects/java.html>.
  293.  
  294.   Per Bothner of Cygnus has written free replacements (more-or-less) for
  295.   javah and javap. (See ftp.cygnus.com:pub/bothner/gjava*.tar.gz.)
  296.  
  297.   Erik Troan of Red Hat and your humble editor are attempting to put
  298.   together a development group to do the rest of the job.  Right now it
  299.   looks like we'll use guavac as the compiler, Erik will do the class
  300.   library and your humble editor will do the byte-code interpreter (if
  301.   Cygnus hasn't gotten there first).  This project was tentatively named
  302.   "Mr. Coffee" but is now called JOLT (Java Open Library & Tools).
  303.  
  304.   3.6.  Are there any FRS Java Tools?
  305.  
  306.   There is a GNU Emacs mode for editing Java.  You can fetch it from
  307.   <ftp://java.sun.com/pub/java/contrib/emacs>.  Note: this mode assumes
  308.   you're using c++-mode.el, and won't work with the cc-mode.el
  309.   distributed with Emacs 19.
  310.  
  311.   4.  Java On Linux Questions
  312.  
  313.   Here you can learn the nuts and bolts of getting Java running on your
  314.   Linux.
  315.  
  316.   4.1.  Are Java and HotJava included in any of the Linux distributions?
  317.  
  318.   No, not yet, but expect it any week now.
  319.  
  320.   4.2.  How can I get the latest Java distribution for Linux?
  321.  
  322.   Look in  <http://www.blackdown.org/java-linux.html>.  There is a list
  323.   of mirror sites you can download it from.
  324.  
  325.   The files you'll need are linux.jdk-1.0-try1.common.tar.gz and one of
  326.   either linux.jdk-1.0-try3.static-motif-bin.tar.gz or
  327.   linux.jdk-1.0-try3.shared-motif-bin.tar.gz, depending on whether you
  328.   have Motif shared libraries on your system.
  329.  
  330.   If you have Red Hat Linux or some other system that speaks RPM, you
  331.   can install the 1.0 beta from
  332.   <ftp://java.blackdown.org//pub/Linux/RPMS/i386/JDK-linux-
  333.   common-1.0b-1.i386.rpm> and
  334.   <ftp://java.blackdown.org//pub/Linux/RPMS/i386/JDK-linux-
  335.   static-1.0b-1.i386.rpm> or
  336.   <ftp://java.blackdown.org//pub/Linux/RPMS/i386/JDK-linux-
  337.   shared-1.0b-1.i386.rpm>.
  338.  
  339.   For European users, the contents of
  340.   ftp://java.blackdown.org/pub/Java/linux and
  341.   ftp://java.blackdown.org/pub/Linux/RPMS/i386/JDK-linux* are now
  342.   mirrored in the UK in  <ftp://ftp.linux.org.uk/pub/linux/java>.
  343.   That's zen.btc.uwe.ac.uk, in case anyone cares.  Mirroring happens
  344.   daily at about 6am UK time.
  345.  
  346.   This port (from the Sun sources by Randy Chapman) is the one that's
  347.   referred to (as the JDK) elsewhere in this HOWTO.
  348.  
  349.   4.3.  What environment will I need to run Java?
  350.  
  351.   For starters, you need an ELF-based Linux.  There is no a.out support,
  352.   and at the speed the Linux world is switching over to ELF there is not
  353.   likely to be any in the future.
  354.  
  355.   You need a 1.2.13 or later kernel.  Kernels 1.2.12 and older seem to
  356.   have a bug in getcwd(3) that tanks bin/javac because it doesn't check
  357.   the getcwd(3) return code.
  358.  
  359.   You'll need these pieces:
  360.  
  361.   ╖  libc.so.5 => /lib/libc.so.5.2.18
  362.  
  363.   ╖  libX11.so.6 => /usr/X11/lib/libX11.so.6.0
  364.  
  365.   ╖  libXt.so.6 => /usr/X11/lib/libXt.so.6.0
  366.  
  367.   ╖  libXext.so.6 => /usr/X11/lib/libXext.so.6.0
  368.  
  369.   ╖  libXpm.so.4 => /usr/X11/lib/libXpm.so.4.3
  370.  
  371.   ╖  libdl.so.1 => /lib/libdl.so.1.7.9
  372.  
  373.      The C and X support libraries may be in your Linux already.
  374.  
  375.   If you don't already have it, get libc.5.2.18.bin.tar.gz from
  376.   <ftp://tsx-11.mit.edu/pub/linux/packages/GCC/>.  Uncompress and untar
  377.   and copy the files in the lib subdirectory of the top level of the
  378.   hierarchy to /lib.
  379.  
  380.   If you don't have a current version of ld.so (or libdl.so.1.7.*) you
  381.   will need to update. ld.so.1.7.9 and .11 will work; .10 and other
  382.   early versions will not. Get ld-so.1.7.14.tar.gz from
  383.   <ftp://ftp.ods.com/pub/linux/>; Uncompress and untar it and run
  384.   instldso.sh which is in the top level of the resulting hierarchy.
  385.   You can get an Xpm library that will work from
  386.   <ftp://sunsite.unc.edu/pub/Linux/libs/X/libXpm.3.4f-ELF.tar.gz>.
  387.  
  388.   4.4.  Do I need Netscape?  Can I use Netscape?
  389.  
  390.   Yes, you need Netscape.  HotJava isn't yet available for the beta pr
  391.   1.0 releases.  Randy Chapman says:
  392.  
  393.        Sun massively changed the awt interface when they shipped
  394.        the beta JDK and have not yet converted HotJava to it.  They
  395.        have promised they will, and it should work great with
  396.        linux-jdk when they release it.
  397.  
  398.   It's unknown when this will happen.
  399.  
  400.   Netscape versions starting from 2.0b3 are Java-aware.  It is available
  401.   at ftp1-7.netscape.com (i.e. at ftp1.netscape.com,
  402.   ftp2.netscape.com,... etc.)  Version 2.0b4 and up will allow you to
  403.   read applets from file: URLs, 2.0b3 didn't.  This should be a big help
  404.   for folks with small-memory machines (they don't need an httpd
  405.   running).
  406.  
  407.   Note that Netscape will run on an a.out system, so it is, in theory,
  408.   possible to write your java app, give it to someone else to compile
  409.   (like maybe the BlackStar Public Compiler
  410.   <http://mars.blackstar.com>), and see the output on your system.  If
  411.   you want more than that, get an ELF system.
  412.  
  413.   Make sure CLASSPATH is not set before running netscape; having it set
  414.   seems to crash Netscape, and if you follow the directions below it
  415.   won't need tweaking.
  416.  
  417.   The Linux Netscape port has a few known problems.  It doesn't do
  418.   sound.  Only 8-bit displays work; 16bpp displays yield crashes.  The
  419.   2.0b3 version occasionally yields bus errors when caling the dispose
  420.   method for frames.  While it's pretty robust otherwise, Gamelan's
  421.   `Impressionism' applet is known to crash it.
  422.  
  423.   4.5.  What mailing lists or newsgroups exist for supporting Java on
  424.   Linux?
  425.  
  426.   ╖  java-linux (Maintained by karl@blackdown.org) Discussions and
  427.      developments concerning the port of Java to the Linux operating
  428.      system. Email to java-linux-request@java.blackdown.org with the
  429.      word `subscribe' in the subject to be added to the list.
  430.  
  431.   ╖  java-linux-announce (Maintained by karl@blackdown.org) Moderated
  432.      list for announcements concerning the Java-Linux porting projects.
  433.      Please send e-mail to java-linux-announce-
  434.      request@java.blackdown.org with the word subscribe in the subject,
  435.      to be added to the list.
  436.  
  437.   ╖  comp.lang.java Newsgroup for general Java discussion.
  438.  
  439.   ╖  alt.www.hotjava Newsgroup for discussion of the HotJava browser.
  440.  
  441.   5.  Building the Linux Java port on stock Linuxes
  442.  
  443.   In this section, we collect recipes sent to us for building Randy
  444.   Chapman's Java port on various current Linux distributions:
  445.  
  446.   5.1.  Slackware distribution ELF kernel 1.2.13.
  447.  
  448.   John Franks <john@math.nwu.edu> writes that he succeeded with the
  449.   following steps:
  450.  
  451.   ╖  Get linux-x86.jdk.static-motif.tar.gz from
  452.      <ftp://www.blackdown.org/pub/Java/linux/> and uncompress it and
  453.      untar it.  (The filenames you must fetch have changes for the 1.0
  454.      beta JDK.)
  455.  
  456.   ╖  Get libc.5.2.18.bin.tar.gz (binary distribution, not source) from
  457.      <ftp://tsx-11.mit.edu/pub/linux/packages/GCC/> Uncompress and untar
  458.      and copy the files in the lib subdirectory of the top level of the
  459.      hierarchy to /lib.  Make sure that /lib/libc.so.5 is a symlink to
  460.      this file.
  461.  
  462.   ╖  Get ld-so.1.7.14.tar.gz from ftp://ftp.ods.com/linux/ Uncompress
  463.      and untar it and run "instldso.sh" which is in the top level of the
  464.      resulting hierarchy.
  465.  
  466.      You should now be able to compile and try the "hello world" program
  467.      and applet from Sun following the instructions at
  468.      <http://java.sun.com/progGuide/index.html>.
  469.  
  470.   5.2.  RedHat 2.1/Caldera Preview 2
  471.  
  472.   Steve Greene <sgreene@access.digex.net> reports success doing the
  473.   following steps.  I have edited the recipe slightly, so blame any
  474.   mistakes on me.  The `JDK' he refers to is the Chapman port of the
  475.   Java Developer's Kit.
  476.  
  477.   ╖  From a Red Hat mirror site, get the rpm available for ld.so.1.7.14.
  478.      To find it, check any RedHat mirror site for:
  479.  
  480.      /pub/mirrors/redhat-2.1/updates/RPMS/ld.so-1.7.14-i386.rpm
  481.  
  482.      I know it is available at ftp.pht.com, ftp.caldera.com. and is
  483.      probably at the other RedHat mirrors as well.  Grab it, and do `rpm
  484.      -Uvh ld.so-1.7.14-1.i386.rpm' on your system.
  485.  
  486.   ╖  Red Hat 2.0 and Caldera Preview 2 users may need the `which'
  487.      program (it's called by some of the scripts in the JDK).  An rpm
  488.      file for `which' is available at the usual Red Hat mirror sites as
  489.      part of the Red Hat 2.1 distribution files.  Get and install
  490.      which-1.0.i386.rpm.  RedHat 2.1 users should already have which on
  491.      their system or available within their original distribution.
  492.  
  493.   ╖  Get the tar file(s) for the statically-linked JDK.  Untar it from a
  494.      convenient point.  I put mine in /usr/local, so the untar creates
  495.      /usr/local/java/....
  496.  
  497.   ╖  So you can run java as someone other than root (this is a good
  498.      idea!), do `chmod 666 /dev/zero'.   Red Hat and Caldera have the
  499.      wrong permissions set on this device out of the box.
  500.  
  501.   ╖  If you haven't already, run ldconfig as root to load the new
  502.      libraries.  If you do "ldconfig -v"  you can verify you have all
  503.      the libraries loaded.  (At least we don't have to build an ELF
  504.      system first!)
  505.  
  506.   ╖  Make sure you're logged in as a user (e.g. non-root).  Start X-
  507.      windows, open an X-Term, and try something!
  508.  
  509.   5.3.  Unifix
  510.  
  511.   Stefan Middendorf writes: Unifix is a popular German-language Linux
  512.   distribution. There are a few distributions based on it: Linux
  513.   Universe, sold in USA, Linux 4U, currently only distributed in Germany
  514.   and Linux FT in Britain.  This recipe is known to work for Unifix 1.7,
  515.   Linux 4U 1st Edition, Linux Universe 2nd Edition, and Linux FT 1.1.
  516.  
  517.   ╖  Put linux-x86.jdk.static-motif.tar.gz from
  518.      <ftp://www.blackdown.org/pub/Java/linux/> in /usr/local and
  519.      uncompress it and untar it.
  520.  
  521.   ╖  Change the first line of the script .java_wrapper from PRG=`which
  522.      $0` >/dev/null 2>&1 to
  523.  
  524.      PRG=`type $0 | cut -d ' ' -f 3` >/dev/null 2>&1
  525.  
  526.   ╖  Get libc-5.2.18.bin.tar.gz (I succeeded with
  527.      libc-5.2.16.bin.tar.gz, too), extract and uncompress it in the /
  528.      drectory.
  529.  
  530.   ╖  Get ld-so.1.7.12.tar.gz from tsx-11.mit.edu (or any mirror site)
  531.      and uncompress and untar it, e.g. in /usr/local.  Change to the
  532.      resulting directory and run instldso.sh. This will also run
  533.      ldconfig.  Probably newer versions of ld-so will work too.
  534.  
  535.   ╖  Add /usr/local/java/bin to the PATH environment variable.
  536.  
  537.   ╖  Get netscape-v20b4-export.i486-unknown-linux.tar.Z, extract and
  538.      uncompress it in /usr/local/<yourNetscapeDir>.
  539.  
  540.   ╖  Create a Link in /usr/local/bin to ../<yourNetscapeDir>/netscape.
  541.  
  542.   ╖  Put /usr/local/<yourNetscapeDir>/moz2_0.zip in
  543.      /usr/local/lib/netscape/.
  544.  
  545.   As an alternative to changing your PATH, Ralf Strobel suggests:
  546.  
  547.   ╖  Copy the scripts .java_wrapper and appletviewer and the links @java
  548.      @javac, @javadoc, @javap, and @jdb from /usr/local/java/bin to
  549.      /usr/local/bin and you can use them wherever you are.
  550.  
  551.   ╖  In /java/bin/i586 you can add a script called `javadoc`
  552.  
  553.      #!/bin/sh `dirname $0`/java sun.tools.javadoc.Main -d <yourhtmldir>
  554.      $*
  555.  
  556.      where if you are user jrandom, <yourhtmldir> would be
  557.      jrandom/.java-html.
  558.  
  559.   6.  Viewing Applets
  560.  
  561.   To run a demo without going through the applet viewer, you can enter
  562.   this command from the top of my Java directory tree (/usr/local/java
  563.   on most systems):
  564.  
  565.   bin/java sun.applet.AppletViewer demo/<directory_name>/exampleN.html
  566.  
  567.   where <directory name> is the subdirectory off demo, and N is the
  568.   number of the example file (some directories have more than one).
  569.  
  570.   Steve Greene says: I've started the tutorials available from Sun's
  571.   java site and the similar one put out by the NTMUG.  I've discovered
  572.   some problems with the syntax in Sun's tutorial, so I've been
  573.   following the NYMUG tutorial instead for now.
  574.  
  575.   The appletviewer expects as an argument, an html file with an APPLET
  576.   tag inside it.
  577.  
  578.   For example, if your html file Hello.html looks like:
  579.  
  580.           <HTML>
  581.           <HEAD>
  582.           <TITLE> Hello test program </TITLE>
  583.           < /HEAD>
  584.           <BODY>
  585.           This is an appletviewer test
  586.           <APPLET CODE="Hello1.class" WIDTH=150 HEIGHT=25>
  587.           < /APPLET>
  588.           < /BODY>
  589.           < /HTML>
  590.  
  591.   (If you see "< /" in the above, ignore the space.  It's a workaround
  592.   for a formatter bug.)
  593.  
  594.   Running "appletviewer Hello.html" will show you the applet. One
  595.   advantage of using the appletviewer is that events sent to the applet
  596.   (start(), init(), etc) are in compliance with Sun specs as opposed to
  597.   Netscape 2.0b4 (probably a bug in Netscape).
  598.  
  599.   A disadvantage of using the appletviewer is that it is much slower
  600.   than Netscape.
  601.  
  602.   The first time you run Java, a license screen resembling Netscape's
  603.   will be displayed.
  604.  
  605.   7.  Notes on Known Problems
  606.  
  607.   7.1.  GNU Make breaks after I install Java
  608.  
  609.   Recent versions of libc fix a bug which masked a bug in GNU Make (the
  610.   symptom is that make doesn't look in Makefile for rules).  The libc
  611.   5.2.8 release notes give a patch to make that fixes the problem.  You
  612.   can also grab a fixed version from
  613.   <ftp://sunsite.unc.edu/pub/Linux/devel/make/make-3.74-direntfix-
  614.   elf.tgz>.
  615.  
  616.   7.2.  You get `dirname: too many arguments' errors
  617.  
  618.   Your CLASSPATH variable is not correctly initialized.  In
  619.   .java_wrapper, there is code akin to the follwing:
  620.  
  621.           PRG=`which $0`
  622.           J_HOME=`dirname $PRG`/..
  623.  
  624.   Unfortunately, linux's standalone which command is hideously broken,
  625.   and certain shells will set $0 to the full pathname.  Randy Chapman
  626.   says the fix is either to use:
  627.  
  628.            J_HOME=`dirname $0`/..
  629.  
  630.   Or, safer:
  631.  
  632.            J_HOME=/usr/local/java
  633.  
  634.   An alternate fix from Dave Dittrich is:
  635.  
  636.            PRG=`csh -c "which $0"`
  637.  
  638.   And another one from Tim Farnum is to change the PRG=`which $0` line
  639.   to
  640.  
  641.            PRG=$0
  642.  
  643.   Lutz Behnke suggests:
  644.  
  645.            PRG=`type -path $0` >/dev/null 2>&1
  646.  
  647.   A similar change also needs to be made to the appletviewer script.
  648.  
  649.   7.3.  You get `cannot find class java/lang/Thread' errors
  650.  
  651.   Your CLASSPATH variable is not correctly initialized.  See above.
  652.  
  653.   7.4.  An error message refers to /dev/zero
  654.  
  655.   Go root and do `chmod 666 /dev/zero'.
  656.  
  657.   7.5.  SEGFAULT
  658.  
  659.   Occasionally, you may get a screen full of error messages, and the
  660.   system cheerfully fills up your swap space and locks-up.
  661.  
  662.   You're probably missing a library someplace.  Rerun ldconfig -v and
  663.   see what's missing. Perhaps LD_LIBRARY_PATH or CLASS_PATH is not set.
  664.   Finally, some applets are buggy or lock up the Linux JDK.
  665.  
  666.   (BTW, you can stop the lock-up by having another Xterm open with top
  667.   running; use top to kill the java process BEFORE it fills up swap and
  668.   hangs your system!)
  669.  
  670.   Java seems to want lots of resources, so I'd keep the number of
  671.   running/open apps on my desktop to a minimum.  It will load on a
  672.   486DX-2-75 with 8 Mbytes RAM and 16 Mbytes swap (it'll take a minute,
  673.   though).  I was able to get two animation applets running
  674.   simultaneously (sort of) before my system ran out of swap space and
  675.   hung.
  676.  
  677.   7.6.  bin/java, bin/javac, or bin/appletviewer gives you a help screen
  678.  
  679.   You left out some command-line parameter.
  680.  
  681.   7.7.  Applets show in the viewer but not when put on a web server
  682.  
  683.   A common error which causes these results is failing to get the MIME
  684.   type of the applet correct.  Your server should send a header with the
  685.   applet indicating that its MIME type is "text/plain",
  686.   "application/octet-stream", or some other type that doesn't have a
  687.   defined special handler on the client side.  How you arrange this
  688.   depends on which server you are using. (John Franks)
  689.  
  690.   It's also been alleged that tinyhttpd, an HTTP server written in Perl,
  691.   returns a bad content type.  Apache, OTOH, is pretty reliable.
  692.  
  693.   7.8.  Problem Logging
  694.  
  695.   Joey Oravec tells us that HotJava keeps a log of what it does and any
  696.   problems in encounters. If you're up to diagnosing something yourself,
  697.   look at $HOME/.hotjava/weblog in the user's home directory.  That file
  698.   will make it more obvious if you're perhaps missing a library or
  699.   something.
  700.  
  701.   8.  Related Resources
  702.  
  703.   Jeff Harrington maintains a Java hints page at
  704.   <http://www.parnasse.com/java.shtml>.
  705.  
  706.   For general information on Java, there is a FAQ maintained on the
  707.   comp.lang.java newsgroup; it is available at <http://www.city-
  708.   net.com/~krom/java-faq.html>.
  709.  
  710.   There is an older FAQ-style document by Joey Oravec
  711.   joey@sun.science.wayne.edu <mailto:joey@sun.science.wayne.edu> which
  712.   primarily refers to the alpha release.  You can find it at
  713.   <http://www.science.wayne.edu/~joey/java/linux.html>.  At some point
  714.   these documents may merge.
  715.  
  716.   Here are some Java-related pages:
  717.  
  718.   ╖  Karl Asha's General Linux Java Page
  719.      <http://substance.blackdown.org/java-linux.html> LinuxJava Mailing
  720.      List <http://homer.ncm.com/java-linux/> Netrek for Java
  721.      <http://www.cs.utexas.edu/users/hiep/netjav.html> Blue-Skies for
  722.      Java <http://cirrus.sprl.umich.edu/javaweather/> Java Hints Page
  723.      <http://www.parnasse.com/java.shtml>
  724.  
  725.   9.  To Be Added...
  726.  
  727.   ╖  More recipes for specific Linux variants.
  728.  
  729.   10.  Acknowledgements
  730.  
  731.   Grateful acknowledgement is made to all contributors, including:
  732.  
  733.   ╖  John Franks <john@math.nwu.edu>
  734.  
  735.   ╖  Zachary DeAquila <zachary@zachs.place.org>
  736.  
  737.   ╖  Steve Greene <sgreene@access.digex.net>
  738.  
  739.   ╖  Dave Dittrich <dittrich@cac.washington.edu>
  740.  
  741.   ╖  Dave Flanagan <dave@ora.com>
  742.  
  743.   ╖  Joey Oravec <mailto:joey@sun.science.wayne.edu>
  744.  
  745.   ╖  Adam Smith <aws@cs.brown.edu>
  746.  
  747.   ╖  Joe Buck <jbuck@Synopsys.COM>
  748.  
  749.   ╖  Omar Loggiodice <ologgio@netdepot.com>
  750.  
  751.   ╖  Stefan Middendorf <mdorf@stud.fh-heilbronn.de<
  752.  
  753.   This version incorporates Steve Greene's rumored but never-published
  754.   Red Hat/Caldera mini-HOWTO.  I've also swiped some stuff I consider
  755.   useful off Joey Oravec's page -- special thanks to him.
  756.  
  757.   For other HOWTOs and FAQs I maintain, see my home page at
  758.   <http://www.ccil.org/~esr/home.html>.
  759.  
  760.